package com.designPattern.composite;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * @author mxs
 */
public class Collage extends OrganizationComponent{
    List<OrganizationComponent> department = new ArrayList();
    public Collage(String des, String name) {
        super(des, name);
    }

    @Override
    public void print() {
        System.out.println(getName());
        System.out.println("=========================");
        for (OrganizationComponent department1 : department) {
            department1.print();
        }
    }

    @Override
    public void add(OrganizationComponent organizationComponent) {
        department.add(organizationComponent);
    }

    @Override
    public void delete(OrganizationComponent organizationComponent) {
        department.remove(organizationComponent);
    }
}
